<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Api_Model_TourLocation
{
	private $tour_id;
	private $location_id;
	private $created_time;
	private $updated_time;

	public function __construct($tourlocation_row = null) {
		if(!is_null($tourlocation_row) && $tourlocation_row instanceof Zend_Db_Table_Row) {
			$this->tour_id = $tourlocation_row->tour_id;
			$this->location_id = $tourlocation_row->location_id;
			$this->created_time = $tourlocation_row->created_time;
			$this->updated_time = $tourlocation_row->updated_time;
		}
	}

	public function __set($name, $value) {
		switch($name) {
			case 'tour_id':
				if(!is_null($this->tour_id)) {
					throw new Exception('Cannot update tour\'s id');
				}
				break;
			case 'location_id':
				if(!is_null($this->location_id)) {
					throw new Exception('Cannot update location\'s id');
				}
				break;
			case 'created_time':
				if(!is_null($this->created_time)) {
					throw new Exception('Cannot update created time');
				}
				break;
			case 'updated_time':
				if(!is_null($this->updated_time)) {
					throw new Exception('Cannot update updated time');
				}
				break;
		}
		$this->$name = $value;
	}

	public function __get($name) {
		return $this->$name;
	}
}
